$(function () {
    // 加载更多内容
    $(window).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if ((scrollTop + windowHeight) == (scrollHeight)) {
            //loadData();
        }
    });
})
var type = 10;//今日推荐
var current = 1;
var finish = false;

function loadData() {//加载更多按钮
    if (finish) {
        return;
    }
    $(".load-more").show();
    $(".load-more-two").hide();
    $(".no-data").hide();

    current++;
    console.log(current);
    $.get("http://192.168.0.100:9001/zx/load/" + current, function (data) {
        $(".load-more").hide();
        //如果没有数据了就隐藏
        if (data.length == 0) {
            finish = true;
            $(".no-data").show();
        } else {
            $(".load-more-two").show();
            $("#myContentList").append(data);
        }
    });
}

//点击推荐，热门，推荐
function clickType(obj, val) {
    type = val;
    current = 0;
    finish = false;
    $("#myContentList").html("");
    $(".main-tab-ul li").removeClass("main-tab-active");
    $(obj).addClass("main-tab-active");
    loadData();
}
